const title = ['#', '接收人（微信昵称）', '告警企业', '告警内容', '推送时间', '推送状态'];
const label = ['order', 'receiver', 'ename', 'content', 'recordtime', 'status'];
$(function () {
    loadMessageLog();
    loadEnterprise();
})
function loadMessageLog(_pageIndex) {
    if(oneMonthLimit($('#searchTimeBegin').val(),$('#searchTimeEnd').val())){
        showModalHint("none","请将时间范围控制在30天内");
        return;
    }
    let pageIndex = parseInt(_pageIndex ? _pageIndex : '1');
    $('#messageLogList tbody').empty();
    showLoading(LOADING);
    getJson("/alarm/findAlarmMsgLog",{
        eId:$('#company-list').val(),
        beginTime:$('#searchTimeBegin').val(),
        endTime:$('#searchTimeEnd').val(),
        status:$('#status_id').val(),
        type:$('#type_id').val(),
        pageIndex: pageIndex,
        pageSize: 10
    },'GET',function (result) {
        if(result.code==200){
            let data = result['payload']['data'];
            setPage($('#page'), pageIndex, result['payload']['pages'], result['payload']['total'], function (num) {
                loadMessageLog(num);
            });
            let order = 1 + 10 * (pageIndex - 1);
            for (let item of data) {
                item['order'] = order++;
            }
            buildTable($("#messageLogList"),title,label,data);
            hideLoading();
        }else{
            myAlert("提示",result.message);
        }

    })
}